from pages.base_page import BasePage
from selenium.webdriver.common.by import By



class CluePoolPage(BasePage):
    url = "/crm/index.php?m=leads&a=index&by=public"
    receive_clue_locator = (By.CSS_SELECTOR,'#form1 > table > tbody > tr:nth-child(1) > td:nth-child(10) > a:nth-child(4)')
    receive_success_locator = (By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')
    allocation_clue_locator = (By.CSS_SELECTOR,'#form1 > table > tbody > tr:nth-child(1) > td:nth-child(10) > a.fenpei')
    allocation_ok_locator = (By.CSS_SELECTOR,'body > div:nth-child(11) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)')
    allocation_success_locator = (By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')

    # 点击领取线索
    def receive_clue(self):
        self.driver.find_element(*self.receive_clue_locator).click()
    # 返回领取成功的提示信息
    def receive_success(self):
        return self.driver.find_element(*self.receive_success_locator).text
    #点击分配线索
    def allocation_clue(self):
        self.driver.find_element(*self.allocation_clue_locator).click()
    #点击分配线索的确定按钮
    def allocation_ok(self):
        self.driver.find_element(*self.allocation_ok_locator).click()
    #返回分配成功的提示信息
    def allocation_success(self):
        return self.driver.find_element(*self.allocation_success_locator).text




